package com.xiaocz.hblsubstitutedriving.adapter;

import android.support.v4.content.ContextCompat;
import android.view.View;
import android.widget.TextView;

import com.xiaocz.common.widgets.recycler.RecyclerViewAdapter;
import com.xiaocz.hblsubstitutedriving.R;
import com.xiaocz.hblsubstitutedriving.model.FlowRecord;
import com.xiaocz.hblsubstitutedriving.model.WithDrawDeposit;


/**
 * Author:  xiaocz.
 * Date:    2018/05.04.
 * Descr:  订单流水记录
 */
public class FlowRecordListAdapter extends RecyclerViewAdapter<FlowRecord> {

    public FlowRecordListAdapter(AdapterListener<FlowRecord> adapterListener) {
        super(adapterListener);
    }

    @Override
    protected int getItemViewType(int position, FlowRecord data) {
        return R.layout.item_flow_record_list;
    }

    @Override
    protected ViewHolder<FlowRecord> getViewHolder(View view, int viewType) {
        return new InfoTypeViewHolder(view);
    }

    private static class InfoTypeViewHolder extends ViewHolder<FlowRecord> {

        private TextView tvTitle, tv_state, tv_create_time;

        private InfoTypeViewHolder(View itemView) {
            super(itemView);
            tvTitle = itemView.findViewById(R.id.info_title);
            tv_state = itemView.findViewById(R.id.tv_state);
            tv_create_time = itemView.findViewById(R.id.tv_create_time);
        }

        @Override
        protected void onBind(FlowRecord data, int position) {
            tvTitle.setText(String.valueOf(data.getChangeMoney()+"元"));
            tv_create_time.setText(data.getCreatetime());
            tv_state.setText(data.getLogType());
        }

        @Override
        public boolean isNeedClick() {
            return true;
        }
    }
}